package com.teen9g.userserver.controller;

import com.netflix.discovery.converters.Auto;
import com.teen9g.entity.User;
import com.teen9g.result.Result;
import com.teen9g.userserver.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping
    public Result<List<User>> findAll() {
        List<User> list = userService.list();
        return Result.success(list);
    }
}
